package cn.shadowsouls.system.bean.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 
 * @TableName vote
 */
@TableName(value ="vote")
@Data
@NoArgsConstructor
public class Vote implements Serializable {
    /**
     * 
     */
    @TableId(value = "vote_id", type = IdType.AUTO)
    private Integer voteId;

    /**
     * 
     */
    @TableField(value = "vote_name")
    private String voteName;

    /**
     * 
     */
    @TableField(value = "vote_intro")
    private String voteIntro;

    /**
     * 
     */
    @TableField(value = "createTime")
    private Date createTime;

    /**
     * 
     */
    @TableField(value = "updateTime")
    private Date updateTime;

    /**
     * 
     */
    @TableField(value = "beginTime")
    private Date beginTime;

    /**
     * 
     */
    @TableField(value = "endTime")
    private Date endTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    public Vote(String voteName, String voteIntro, Date beginTime, Date endTime) {
        this.voteName = voteName;
        this.voteIntro = voteIntro;
        this.beginTime = beginTime;
        this.endTime = endTime;
    }

    public Vote(String voteName, String voteIntro) {
        this.voteName = voteName;
        this.voteIntro = voteIntro;
        this.beginTime=new Date();
        this.endTime=new Date();

    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Vote other = (Vote) that;
        return (this.getVoteId() == null ? other.getVoteId() == null : this.getVoteId().equals(other.getVoteId()))
            && (this.getVoteName() == null ? other.getVoteName() == null : this.getVoteName().equals(other.getVoteName()))
            && (this.getVoteIntro() == null ? other.getVoteIntro() == null : this.getVoteIntro().equals(other.getVoteIntro()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getBeginTime() == null ? other.getBeginTime() == null : this.getBeginTime().equals(other.getBeginTime()))
            && (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getVoteId() == null) ? 0 : getVoteId().hashCode());
        result = prime * result + ((getVoteName() == null) ? 0 : getVoteName().hashCode());
        result = prime * result + ((getVoteIntro() == null) ? 0 : getVoteIntro().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getBeginTime() == null) ? 0 : getBeginTime().hashCode());
        result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode());
        return result;
    }


}